using System;
using System.Runtime.Serialization;

namespace Lync.Widget.Library.InstantMessaging
{
    [DataContract]
	public class GroupMessage
	{
        public GroupMessage(string sip, string value, MessageType messageType)
		{
            SipUri = sip;
            Value = value;
			Type = messageType;
		}
        
        [DataMember]
        public string SipUri { get; set; }

        [DataMember]
		public string Value { get; set; }

        [DataMember]
        public string Name { get; set; }        

		// hack to get the enum string return in json format
		[DataMember(Name = "Type")]
		public string TypeString { get; private set; }
        
		public MessageType Type
		{
			get
			{
				return (MessageType)Enum.Parse(typeof(MessageType), TypeString);
			}
			set
			{
				TypeString = value.ToString();	
			}
		}
	}
}